#include "StdAfx.h"
#include "UIDatas.h"

void ScriptBackend::Module_UIDatas( lua_State* l )
{
	using namespace luabind;
	using namespace CEGUI;

	module(l)
		[
			class_<UDim>("UDim")
			.def(constructor<>())
			.def(constructor<float,float>())
			//.property("string",&UDimToString)
			.def_readwrite("Offset",&UDim::d_offset)
			.def_readwrite("Scale",&UDim::d_scale)
			.def("AsRelative",&UDim::asRelative)
			.def("AsAbsolute",&UDim::asAbsolute)
			.def(const_self == other<const UDim&>())				
			.def(const_self + other<const UDim&>())
			.def(const_self - other<const UDim&>())
			.def(const_self * other<const UDim&>())
			.def(const_self / other<const UDim&>())	
			//.def("parse",&parseUDim)
			,
			class_<UVector2>("UVector2")
			.def(constructor<>())
			.def(constructor<UDim,UDim>())				
			.def_readwrite("X",&UVector2::d_x)
			.def_readwrite("Y",&UVector2::d_y)
			.def("AsRelative",&UVector2::asRelative)
			.def("AsAbsolute",&UVector2::asAbsolute)
			.def(const_self == other<const UVector2&>())				
			.def(const_self + other<const UVector2&>())
			.def(const_self - other<const UVector2&>())
			.def(const_self * other<const UVector2&>())
			.def(const_self / other<const UVector2&>())					
			//.def("test",&test)
			,
			class_<Size>("Size")
			.def(constructor<>())
			.def(constructor<float,float>())
			.def_readwrite("Width",&Size::d_width)
			.def_readwrite("Weight",&Size::d_height)
			.def(const_self == other<const Size&>())
			,
			class_<Point>("Point")
			.def(constructor<>())
			.def(constructor<float,float>())
			.def_readwrite("X",&Point::d_x)
			.def_readwrite("Y",&Point::d_y)
			.def("AsSize",&Point::asSize)
			.def(const_self == other<const Point&>())
			.def(const_self + other<const Point&>())
			.def(const_self - other<const Point&>())
			.def(const_self * other<const Point&>())
			// 				,
			// 				class_<Vector3>("Vector3")
			// 				.def(constructor<>())
			// 				.def(constructor<float,float,float>())
			// 				.def_readwrite("x",&Vector3::d_x)
			// 				.def_readwrite("y",&Vector3::d_y)
			// 				.def_readwrite("z",&Vector3::d_z)
			// 				.def(const_self == other<const Vector3&>())
			,
			class_<Rect>("Rect")
			.def(constructor<>())
			.def(constructor<float,float,float,float>())
			.def(constructor<Point,Size>())
			.property("Position",&Rect::getPosition,&Rect::setPosition)
			.property("Size",&Rect::getSize,&Rect::setSize)
			.property("Width",&Rect::getWidth,&Rect::setWidth)
			.property("Height",&Rect::getHeight,&Rect::setHeight)
			.def("GetIntersection",&Rect::getIntersection)
			.def("Offset",&Rect::offset)
			.def("IsPointInRect",&Rect::isPointInRect)
			.def("ConstrainSize",&Rect::constrainSize)
			.def("ConstrainSizeMax",&Rect::constrainSizeMax)
			.def("ConstrainSizeMin",&Rect::constrainSizeMin)
			.def_readwrite("Left",&Rect::d_left)
			.def_readwrite("Right",&Rect::d_right)
			.def_readwrite("Top",&Rect::d_top)
			.def_readwrite("Bottom",&Rect::d_bottom)
			,
			class_<colour>("CeguiColor")
			.def(constructor<const colour&>())
			.def(constructor<float,float,float,float>())
			.property("ARGB",&colour::getARGB,&colour::setARGB)
			.property("Alpha",&colour::getAlpha,&colour::setAlpha)
			.property("Red",&colour::getRed,&colour::setRed)
			.property("Green",&colour::getGreen,&colour::setGreen)
			.property("Blue",&colour::getBlue,&colour::setBlue)
			.property("Hue",&colour::getHue)
			.property("Saturation",&colour::getSaturation)
			.property("Lumination",&colour::getLumination)
			.def("Set",&colour::set)
			.def("SetRGB",(void(colour::*)(float,float,float))&colour::setRGB)
			.def("SetRGB",(void(colour::*)(const colour&))&colour::setRGB)
			.def("SetHSL",&colour::setHSL)
			.def("InvertColour",&colour::invertColour)
			.def("InvertColourWithAlpha",&colour::invertColourWithAlpha)				
			.def(const_self == other<const colour&>())
			.def(self + other<const colour&>())
			.def(self - other<const colour&>())
			.def(self * other<const float>())
			,
			class_<ColourRect>("ColourRect")
			.def(constructor<const colour&>())
			.def(constructor<const colour&,const colour&,const colour&,const colour&>())
			.def("SetAlpha",&ColourRect::setAlpha)
			.def("SetTopAlpha",&ColourRect::setTopAlpha)
			.def("SetBottomAlpha",&ColourRect::setBottomAlpha)
			.def("SetLeftAlpha",&ColourRect::setLeftAlpha)
			.def("SetRightAlpha",&ColourRect::setRightAlpha)
			.property("Monochromatic",&ColourRect::isMonochromatic)
			.def("GetSubRectangle",&ColourRect::getSubRectangle)
			.def("GetColourAtPoint",&ColourRect::getColourAtPoint)
			.def("SetColours",&ColourRect::setColours)
			.def("ModulateAlpha",&ColourRect::modulateAlpha)
			.def_readwrite("TopLeft",&ColourRect::d_top_left)
			.def_readwrite("TopRight",&ColourRect::d_top_right)
			.def_readwrite("BottomLeft",&ColourRect::d_bottom_left)
			.def_readwrite("BottomRight",&ColourRect::d_bottom_right)
		];
}